package key.w8.boot.service.factoroyBean;

import key.w8.boot.service.ServiceFactory;
import key.w8.boot.contenxt.ServiceContext;
import org.springframework.beans.factory.FactoryBean;

import java.util.List;

/**
 * @Author: k8
 * @CreateTime: 2025-08-17
 * @Version: 1.0
 */
public class ServiceFactoryFactoryBean implements FactoryBean {
    private final List<ServiceContext> serviceContexts;

    public ServiceFactoryFactoryBean(List<ServiceContext> serviceContexts) {
        this.serviceContexts = serviceContexts;
    }

    @Override
    public Object getObject() throws Exception {
        ServiceFactory serviceFactory = new ServiceFactory(serviceContexts);
        return serviceFactory;
    }

    @Override
    public Class<?> getObjectType() {
        return ServiceFactory.class;
    }
}
